package com.game.framework.utill;

import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.actor.ActorSelection;

public class ActorInfoUtils {

    /**
     * 打印 ActorRef 的详细信息
     */
    public static void printActorRefInfo(String label, ActorRef actor) {
        System.out.println("=== " + label + " ===");
        System.out.println("String: " + actor.toString());
        System.out.println("Path: " + actor.path());
        System.out.println("Serialization Format: " + actor.path().toSerializationFormat());
        System.out.println("Address: " + actor.path().address());
        System.out.println("Name: " + actor.path().name());
        System.out.println("Parent: " + actor.path().parent());
        System.out.println("Elements: " + String.join("/",
                scala.collection.JavaConverters.asJavaCollection(actor.path().elements())));
        System.out.println("UID: " + actor.path().uid());
//        System.out.println("Has Local Scope: " + actor.path().hasLocalScope());
//        System.out.println("Has Global Scope: " + actor.path().hasGlobalScope());
        System.out.println();
    }

    /**
     * 打印 ActorSelection 的详细信息
     */
    public static void printActorSelectionInfo(String label, ActorSelection selection) {
        System.out.println("=== " + label + " ===");
        System.out.println("Anchor Path: " + selection.anchorPath());
        System.out.println("Path String: " + selection.pathString());
        System.out.println("ToString: " + selection);
        System.out.println();
    }

    /**
     * 打印 ActorSystem 的地址信息
     */
    public static void printSystemInfo(ActorSystem system) {
        System.out.println("=== ActorSystem Info ===");
        System.out.println("Name: " + system.name());
        System.out.println("Provider: " + system.provider().getClass().getSimpleName());
        System.out.println("Guardian: " + system.guardian());
//        System.out.println("System Guardian: " + system.systemGuardian());
        System.out.println();
    }
}
